<template>
  <!--头部区域-->
  <el-container class="home-container">
    <el-header
      >宠物信息管理系统<el-button type="info" @click="logout"
        >退出</el-button
      ></el-header
    >
    <!--页面主题区域-->
    <el-container>
      <!--侧边栏-->
      <el-aside width="200px">
        <!--侧边栏菜单区域  router=true为侧边栏开启路由模式 以index作为path进行跳转-->
        <el-menu
          background-color="#e2e1e4"
          text-color="#fff"
          active-text-color="#409EFF"
          :router="true"
          :default-active="$route.path"
        >
          <el-menu-item index="users">
            <i class="el-icon-user-solid"></i>
            <span slot="title">会员信息管理</span>
          </el-menu-item>
          <el-menu-item index="pets">
            <i class="el-icon-menu"></i>
            <span slot="title">宠物信息管理</span>
          </el-menu-item>
          <el-menu-item index="coms">
            <i class="el-icon-s-goods"></i>
            <span slot="title">服务项目管理</span>
          </el-menu-item>
          <el-menu-item index="spes">
            <i class="el-icon-document"></i>
            <span slot="title">订单信息管理</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <!--右侧内容主题-->
      <el-main>
        <!--主体占位符-->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "home",
  methods: {
    logout() {
      //清空token，重定向到登录页
      window.sessionStorage.clear();
      this.$router.push("/login");
    },
  },
};
</script>

<style lang="less" scoped>
.home-container {
  //height: 100%;
  height: 100vh;
}

.el-header {
  background-color: #d1c2d3;
  display: flex;
  justify-content: space-between; // 左右贴边
  padding-left: 0%; // 左边界
  align-items: center; // 按钮水平
  color: #fff;
  font-size: 20px;
  //字居中对齐
  > div {
    //左侧div加布局
    display: flex;
    align-items: center;

    span {
      margin-left: 15px;
    }
  }
}

.el-aside {
  background-color: #d1c2d3;

  .el-menu {
    border-right: none; // 二级菜单对其右边框
  }
}

.el-main {
  background-color: #eaedf1;
}

.logo_img {
  width: 20%;
  height: 100%;
}

.iconfont {
  margin-right: 10px;
}

.toggle-button {
  background-color: #4a5064;
  font-size: 10px;
  line-height: 24px;
  color: #fff;
  text-align: center;
  letter-spacing: 0.2em;
  cursor: pointer; // 显示鼠标指针为：小手
}
</style>